import Axios from 'axios';

/**
 * 获取商户配置信息
 * reqtype：商户id
 * 返回：randomStr随机字符串 sign签名 corpNo商户号 timestamp时间戳
 */
export function getCorpProp(reqtype) {
  return Axios({
    url: 'mpbank-base/getCorpProp',
    method: 'post',
    data: { 'reqtype': reqtype }
  });
}

/**
 * 登录校验
 * loginResp：手机银行merchantlogin接口返回的用户信息密文
 * reqtype：商户id
 * appfrom：页面来源
 * 返回：用户各类信息、token、refreshToken
 */
export function userLogin(loginResp, reqtype, appfrom) {
  return Axios({
    url: 'mpbank-base/userLogin',
    method: 'post',
    data: { 'loginResp': loginResp, 'reqtype': reqtype, 'appfrom': appfrom }
  });
}

// 记录浏览日志
export function setBrowsedLog(usrret, syscod, sysret, pagenm, referer, useragent, trackstamp, eventid) {
  return Axios({
    url: 'mpbank-base/setBrowsedLog',
    method: 'post',
    data: { 'usrret': usrret, 'syscod': syscod, 'sysret': sysret, 'pagenm': pagenm, 'referer': referer, 'useragent': useragent, 'trackstamp': trackstamp, 'eventid': eventid }
  });
}

// 记录推荐信息
export function setRecmID(referer, requri, useragent, dptidt, usernbr) {
  return Axios({
    url: 'mpbank-base/setRecmID',
    method: 'post',
    data: { 'referer': referer, 'requri': requri, 'useragent': useragent, 'dptidt': dptidt, 'usernbr': usernbr }
  });
}

// 获取登录用户信息
export function getUserInfo() {
  return Axios({
    url: 'mpbank-base/getUserInfo',
    method: 'get'
  });
}

// 记录GPS地理位置信息
export function setGpslog(latitude, longitude, address, requri) {
  return Axios({
    url: 'mpbank-base/setGpsLog',
    method: 'post',
    data: { 'latitude': latitude, 'longitude': longitude, 'address': address, 'requri': requri }
  });
}

// 获取手机银行老框架的host地址
export function getTomcatHost() {
  return Axios({
    url: 'mpbank-base/qryTomcatWebhost',
    method: 'get'
  });
}